package com.itbaiyun.usercenter.exception;

import com.itbaiyun.usercenter.common.ErrorCode;

import javax.lang.model.type.ErrorType;

/**
 * 自定义异常类
 */
public class BusinessException extends RuntimeException{
    private String description;

    private int code;

    public BusinessException(String message,int code,String description) {
        super(message);
        this.description = description;
        this.code = code;
    }

    public BusinessException(ErrorCode code,String description) {
        super(code.getMessage());
        this.description = description;
        this.code = code.getCode();
    }

    public BusinessException(ErrorCode code) {
        super(code.getMessage());
        this.code = code.getCode();
    }

    public String getDescription() {
        return description;
    }

    public int getCode() {
        return code;
    }
}
